#   /html/body/div[2]/div/div[3]/div[2]/form/input[1]   全路径,绝对定位
#   //*[@id="sb_form_q"]    相对定位,字符表达式  *：所有标签      查找页面中所有标签中id属性值为sb_form_q的标签
#   //input[@id="sb_from_q"]    //label[contains(@class,'search')]
#                                                   and contains(@id,"search icon")
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

wd = webdriver.Chrome()
#   设置隐式等待时间，轮询
wd.implicitly_wait(5)
wd.maximize_window()
url = "https://cn.bing.com/"
wd.get(url)

wd.find_element(By.XPATH, "//*[@id='sb_form_q']").send_keys("1")
# wd.find_element(By.XPATH,'//*[@id="sb_form_q"]').send_keys("aaaa")
# sleep(2)  # 休眠2秒
# wd.find_element(By.XPATH,"//label[contains(@class,'search')]").click
